import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Bono here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */

public class Bono extends Objeto
{
    private int sprite=0;
    private int delay=0; 
    private int desaparece=0;
    private int puntos;
    /**
     * Act - do whatever the Bono wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public Bono(int pts)
    {
        
        puntos=pts;
        
    }
    public void act() 
    {
        if(checkaInterseccion() || desaparece==350)
        {
            if(checkaInterseccion())
            {
                ((FlagWarWorld)getWorld()).sumaPuntos(puntos);
            }
            getWorld().removeObject(this);
        }
        // Add your action code here.
    }    
    
        public boolean checkaInterseccion()
    {
         desaparece++;
       if (getOneIntersectingObject(Hero.class) != null || getOneIntersectingObject(Body.class) != null )
        {
         return true;
           
           
            
        }
        else
         
        return false;
        
    }
}
